<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
	protected function _initDoctype()
	{
		$this->bootstrap('view');
		$view = $this->getResource('view');
		$view->doctype('XHTML1_STRICT');
	}
	
	protected function _initAutoload()
	{
		$autoloader = Zend_Loader_Autoloader::getInstance();
		$autoloader->registerNamespace('My_');
		return $autoloader;
	}
	

	protected function _initDb()
	{
		$configuration = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
		$dbAdapter = Zend_Db::factory($configuration->resources->db);
		// $dbAdapter->getConnection()->exec("SET NAMES 'utf8'"); // KO if not commented
		Zend_Db_Table_Abstract::setDefaultAdapter($dbAdapter);
	}
	
	protected function _initNavigation()	
	{	
		$user = Zend_Auth::getInstance();
		$this->bootstrap('layout');
		$layout = $this->getResource('layout');
		$view = $layout->getView();
	
		//if($user->hasIdentity())
		//{
			$navContainerConfig = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigationLogged.xml','nav');
		/*}
		else
		{
			$navContainerConfig = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml','nav');
		}*/
		$navContainer = new Zend_Navigation($navContainerConfig);
	
		$view->navigation($navContainer);
	}
}

